
******************************************************************
*  Creates Figure 2
******************************************************************

version 11

# delimit ;
use fig2;


label var r25_59 "Age 25-29";
label var r35_59 "Age 35-39";

drop if regno==81;

gen bigreg="North" if regno>=1 & regno <=6;
replace bigreg="NW" if regno >=7 & regno <=10;
replace bigreg="Central" if regno >=11 & regno <=23;
replace bigreg="Volga-Vy." if regno >=24 & regno <=28;
replace bigreg="Cen. Chern." if regno >=29 & regno <=33;
replace bigreg="Povol." if regno >=34 & regno <=41;
replace bigreg="N Cauc." if regno >=42 & regno <=51;
replace bigreg="Urals" if regno >=52 & regno <=59;
replace bigreg="W Sib" if regno >=60 & regno <=68;
replace bigreg="E Sib" if regno >=69 & regno <=78;
replace bigreg="Far East" if regno >=79 & regno <=88;
replace bigreg="NW" if regno==89;

gen order=1 if bigreg=="North";
replace order=2 if bigreg=="NW";
replace order=3 if bigreg=="Central";
replace order=4 if bigreg=="Volga-Vy.";
replace order=5 if bigreg=="Cen. Chern.";
replace order=6 if bigreg=="Povol.";
replace order=7 if bigreg=="N Cauc.";
replace order=8 if bigreg=="Urals";
replace order=9 if bigreg=="W Sib";
replace order=10 if bigreg=="E Sib";
replace order=11 if bigreg=="Far East";

drop if r25_59==. | r35_59==.;

graph bar (asis) r25_59 r35_59 ,
        over(regno,  label(nolabels))
        over(bigreg, sort(order) label(labsize(small) angle(vertical)))
        bar(2, fcolor(black)) scheme(s2mono)
        ylabel(0(.20)1.60) ytitle("Sex Ratio (M/F)")
        title("Sex Ratios by Russian Region, Ages 25-29 and 35-39, 1959")
        nofill legend(off);


